﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="uctlGroupManagement.ascx.cs"
    Inherits="eSilky.Admin.Usercontrols.uctlGroupManagement" %>

<style type="text/css">
    table tr td
    {
        vertical-align: middle;
    }
    
    .buttontd
    {
        text-align: right;
    }
    .altrow
    {
        background-color: #EEEEEE;
    }
    .tblheader
    {
        background-color: #44587C;
        color: White;
        font-weight: bold;
    }
    .grid
    {
        text-align: center;
    }
    .textbox
    {
        background-color: #EEEEEE;
        border: 1px solid #000000;
        width: 180px;
    }
</style>

<script type="text/javascript">

    $(document).ready(function () {
        $('#btnAddMore').click(function () {
            $('#<%= dvForm.ClientID %>').show();
            $('#<%= dvGrid.ClientID %>').hide();
        });

        $('#btnCancel').click(function () {
            $('#<%=txt_Grp_GroupName.ClientID %>').val('');
            $('#<%=txt_Grp_GroupDescription.ClientID %>').val('');
            $('#<%=txt_Grp_GroupName.ClientID %>').focus();
        });
    });

</script>
<div>
    <div id="dvForm" runat="server">
        <table>
        <asp:HiddenField ID="hdnGrpId" runat="server" />
        <tr>
            <td colspan="2">
                <asp:Label ID="lblMsg" runat="server"></asp:Label>
            </td>
        </tr>
            <tr>
                <td colspan="2" class="tblheader">
                    Group Management
                </td>
            </tr>
            <tr>
                <td>
                    Group Name
                </td>
                <td style="vertical-align: middle;">
                    <asp:TextBox ID="txt_Grp_GroupName" runat="server" CssClass="textbox"></asp:TextBox>
                </td>
            </tr>
            <tr class="altrow">
                <td>
                    Group Description
                </td>
                <td align="center" style="vertical-align: middle;">
                    <asp:TextBox ID="txt_Grp_GroupDescription" runat="server" CssClass="textbox"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="buttontd">
                    <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" CssClass="button" />
                    <input type="button" id="btnCancel" value="Cancel" />
                </td>
            </tr>
        </table>
    </div>

    <div id="dvGrid" runat="server" class="grid" style="width: 300px;">
        <div style="text-align: right;">
            <input type="button" id="btnAddMore" value="Add Group" />
        </div>
        <asp:GridView ID="gvGroup" AutoGenerateColumns="False" runat="server" 
            Width="296px" onrowcommand="gvGroup_RowCommand">
            <Columns>
                <asp:BoundField DataField="grp_name" HeaderText="Name" />
                <asp:BoundField DataField="grp_description" HeaderText="Description" />
                <asp:TemplateField HeaderText ="Action">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="EditGroup" CommandArgument='<%# Eval("grp_id") %>'>Edit</asp:LinkButton>
                        <asp:LinkButton ID="lbtnDelete" runat="server" CommandName="DeleteGroup" CommandArgument='<%# Eval("grp_id") %>'>Delete</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</div>
